package com.poker.consts;

import java.util.HashMap;
import java.util.Map;

public final class Code {

    private Code() {}

    /* 用户状态：正常|锁定|异常|作废 */
    public static final class UserState {

        private UserState() {}

        public static final String NORMAL = "NORMAL";

        public static final String LOCKED = "LOCKED";

        public static final String ERROR = "ERROR";

        public static final String INVALID = "INVALID";

        public static final Map<String, String> CODE_MAP = new HashMap<String, String>();
        static {
            CODE_MAP.put(NORMAL, "正常");
            CODE_MAP.put(LOCKED, "锁定");
            CODE_MAP.put(ERROR, "异常");
            CODE_MAP.put(INVALID, "作废");
        }

        public static final String get(String code) { return getMap(CODE_MAP, code); }

    }

    /* 日志操作方：管理员|用户本人 */
    public static final class OperateAspect {

        private OperateAspect () {}

        public static final String MANAGER = "MANAGER";

        public static final String USER = "USER";

        public static final Map<String, String> CODE_MAP = new HashMap<String, String>();
        static {
            CODE_MAP.put(MANAGER, "管理员");
            CODE_MAP.put(USER, "用户");
        }

        public static final String get(String code) { return getMap(CODE_MAP, code); }

    }
    /* 新闻类型：新闻公告|注册协议|投票规则 */
    public static final class classify {

        private classify () {}

        public static final String TYPE_ONE = "0";

        public static final String TYPE_TWO = "1";

        public static final Map<String, String> CODE_MAP = new HashMap<String, String>();
        static {
            CODE_MAP.put(TYPE_ONE, "德州");
            CODE_MAP.put(TYPE_TWO, "双升");
        }

        public static final String get(String code) { return getMap(CODE_MAP, code); }

    }

    /* 新闻类型：新闻公告|注册协议|投票规则 */
    public static final class NewsType {

        private NewsType () {}

        public static final String NEWS_BULLETIN = "news_bulletin";

        public static final String REGISTER_AGREEMENT = "register_agreement";

        public static final String VOTE_RULE = "vote_rule";

        public static final String PLATFORM_NOTICE = "platform_notice";

        public static final Map<String, String> CODE_MAP = new HashMap<String, String>();
        static {
            CODE_MAP.put(NEWS_BULLETIN, "新闻公告");
            CODE_MAP.put(REGISTER_AGREEMENT, "注册协议");
            CODE_MAP.put(VOTE_RULE, "投票规则");
            CODE_MAP.put(PLATFORM_NOTICE, "平台公告");
        }

        public static final String get(String code) { return getMap(CODE_MAP, code); }

    }

    /* 新闻类型：新闻公告|注册协议|投票规则 */
    public static final class ProductStatus {

        private ProductStatus () {}

        public static final String PRODUCT_ON = "0";

        public static final String PRODUCT_DOWN = "1";

        public static final Map<String, String> CODE_MAP = new HashMap<String, String>();
        static {
            CODE_MAP.put(PRODUCT_ON, "上架");
            CODE_MAP.put(PRODUCT_DOWN, "下架");
        }

        public static final String get(String code) { return getMap(CODE_MAP, code); }

    }

    /* 活动状态：报名中|进行中|已结束 */
    public static final class ActivityStatus {

        private ActivityStatus () {}

        public static final String SIGNING = "1";

        public static final String HAVING = "2";

        public static final String END = "3";

        public static final Map<String, String> CODE_MAP = new HashMap<String, String>();
        static {
            CODE_MAP.put(SIGNING, "报名中");
            CODE_MAP.put(HAVING, "进行中");
            CODE_MAP.put(END, "已结束");
        }

        public static final String get(String code) { return getMap(CODE_MAP, code); }

    }

    private static final String getMap(Map<String, String> map, String code) {
        if (map.containsKey(code)) {
            return map.get(code);
        }
        return "";
    }
}
